$(function () {
  $('.submit-btn').click(function () {
    var formData = $('#form').serializeArray().reduce(function (prev, next) {
      prev[next.name] = next.value
      return prev
    }, {})

    if (formData.username === '') {
      wu.showMessage({
        title: "请输入用户名",
        backgroundColor: '#ff4d4f',
        duration: 2500
      });
      return
    }

    if (formData.password === '') {
      wu.showMessage({
        title: "请输入密码",
        backgroundColor: '#ff4d4f',
        duration: 2500
      });
      return
    }

    // noinspection JSAnnotator
    alert(`用户名：${formData.username}  密码：${formData.password}`)
  })
})